package cn.yuxiaoyuan.feign;

import cn.yuxiaoyuan.constants.FeignServerNameConstants;
import cn.yuxiaoyuan.fallback.RuleFeignApiFallback;
import cn.yuxiaoyuan.pojo.DistanceDto;
import cn.yuxiaoyuan.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

@FeignClient(value = FeignServerNameConstants.ServerName.SERVICE_NAME_RULE,
        fallbackFactory = RuleFeignApiFallback.class,
        path =  FeignServerNameConstants.Prefix.PREFIX_RULE_CALCULATE
        )
public interface RuleFeignApi {

    @PostMapping("/price")
    JSONResult price(@RequestBody DistanceDto distanceDto);

    @GetMapping("/getBaseRule")
    JSONResult getBaseRule();
}
